Skip to content

[feat] 新增 koa 静态服务支持 & HttpServer 自定义 filter 请求过滤器#21

Open
CcSimple wants to merge 2 commits intowallace5303:mainfrom
CcSimple:main
Open

[feat] 新增 koa 静态服务支持 & HttpServer 自定义 filter 请求过滤器#21
CcSimple wants to merge 2 commits intowallace5303:mainfrom
CcSimple:main

Conversation

@CcSimple
Copy link
Copy Markdown
Contributor

可配置 是否启用 静态服务 以及自定义 请求过滤

{
  httpServer: {
  static: {
    enable: true,
    prefix: '/public',
    path: path.join(getExtraResourcesDir(), 'public'),
    options: {}
  },
  filter: (uriPath, ctx) => {
     if (uriPath.startsWith('/public')) {
        return true;
      }
      if (uriPath == 'ee') {
        ctx.response.body  = 'hello ee'
        return true;
      }
      return false;
  },
}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant